load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "variable",
    srcs = [
        "error.go",
        "mock_globalaccessor.go",
        "noop.go",
        "removed.go",
        "sequence_state.go",
        "session.go",
        "statusvar.go",
        "sysvar.go",
        "tidb_vars.go",
        "variable.go",
        "varsutil.go",
    ],
    importpath = "github.com/pingcap/tidb/sessionctx/variable",
    visibility = ["//visibility:public"],
    deps = [
        "//config",
        "//domain/resourcegroup",
        "//errno",
        "//keyspace",
        "//kv",
        "//meta/autoid",
        "//metrics",
        "//parser",
        "//parser/ast",
        "//parser/auth",
        "//parser/charset",
        "//parser/model",
        "//parser/mysql",
        "//parser/types",
        "//planner/util/fixcontrol",
        "//privilege/privileges/ldap",
        "//sessionctx/sessionstates",
        "//sessionctx/stmtctx",
        "//sessionctx/variable/featuretag/disttask",
        "//tidb-binlog/pump_client",
        "//types",
        "//types/parser_driver",
        "//util",
        "//util/chunk",
        "//util/collate",
        "//util/dbterror",
        "//util/disk",
        "//util/execdetails",
        "//util/gctuner",
        "//util/kvcache",
        "//util/logutil",
        "//util/mathutil",
        "//util/memory",
        "//util/paging",
        "//util/replayer",
        "//util/rowcodec",
        "//util/size",
        "//util/stmtsummary/v2:stmtsummary",
        "//util/stringutil",
        "//util/tableutil",
        "//util/tiflash",
        "//util/tiflashcompute",
        "//util/tikvutil",
        "//util/timeutil",
        "//util/tls",
        "//util/topsql/state",
        "//util/versioninfo",
        "@com_github_pingcap_errors//:errors",
        "@com_github_tikv_client_go_v2//config",
        "@com_github_tikv_client_go_v2//kv",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_client_go_v2//util",
        "@com_github_twmb_murmur3//:murmur3",
        "@org_golang_x_exp//maps",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "variable_test",
    timeout = "short",
    srcs = [
        "main_test.go",
        "mock_globalaccessor_test.go",
        "removed_test.go",
        "session_test.go",
        "statusvar_test.go",
        "sysvar_test.go",
        "variable_test.go",
        "varsutil_test.go",
    ],
    embed = [":variable"],
    flaky = True,
    shard_count = 50,
    deps = [
        "//config",
        "//kv",
        "//parser",
        "//parser/auth",
        "//parser/mysql",
        "//parser/terror",
        "//planner/core",
        "//sessionctx/sessionstates",
        "//sessionctx/stmtctx",
        "//testkit",
        "//testkit/testsetup",
        "//types",
        "//util",
        "//util/chunk",
        "//util/execdetails",
        "//util/gctuner",
        "//util/memory",
        "//util/mock",
        "//util/timeutil",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//util",
        "@io_opencensus_go//stats/view",
        "@org_uber_go_goleak//:goleak",
    ],
)
